package com.powernode.ssm;

import cn.hutool.core.date.DateUtil;
import cn.hutool.extra.ftp.Ftp;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.time.Instant;
import java.util.Enumeration;
import java.util.Random;

class test1 {

	@Test
	void contextLoads() {
		Instant startTime = Instant.now();
		System.out.println(startTime.toString());

	}

	@Test
	void printRootPath() {
		/**
		 * System.getProperty("user.dir")用来获取项目根目录
		 * 最好在Edit Configurations中针对某一个测试类的测试方法或springboot启动类
		 * 设置working directory为src的上一级目录
		 */
		System.out.println("System.getProperty(\"user.dir\") = " + System.getProperty("user.dir"));
	}

	@Test
	void printEnvProperties() {
		Enumeration<?> enumeration = System.getProperties().propertyNames();
		while (enumeration.hasMoreElements()){
			String o = (String)enumeration.nextElement();
			System.out.println(o+" = "+System.getProperty(o));
		}
	}

	@Test
	void t2() {
		String param = ".ssm.src.main.java.com.powernode.ssm.";
		String filepath = param+"config.";
		String replace = filepath.replace(".", "\\\\");
		System.out.println(replace);

	}

	@Test
	void t83() {
		String str = "a,b，c,d,e";
		String[] split = str.split("[,，]");
		for (int i = 0; i < 100; i++) {
			String s = split[new Random().nextInt(split.length)];
			System.out.println(s);
		}

	}

}
